﻿@model eShop.Web.Mobile.Models.CategoryListModel
@{
    Layout = null;
}
<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>分类列表-@{@WorkContext.ShopConfig.SiteTitle}触屏版</title>
    @Html.Raw(WorkContext.ShopConfig.SEOKeyword)
    @Html.Raw(WorkContext.ShopConfig.SEODescription)
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <link href="@{@WorkContext.CSSCDN}/mobile/themes/default/css/base.css" rel="stylesheet" type="text/css">
    <link href="@{@WorkContext.CSSCDN}/mobile/themes/default/css/list.css" rel="stylesheet" type="text/css">
    <script src="@{@WorkContext.ScriptCDN}/mobile/scripts/jquery.js" type="text/javascript"></script>
    <script src="@{@WorkContext.ScriptCDN}/mobile/scripts/common.js" type="text/javascript"></script>
</head>

<body>
@Html.Partial("_header")
<script type="text/javascript">
    $("#headerTitle").html("分类列表");
</script>


@if (Model.CategoryInfo == null)
{
<div class="searchBox">
	<div class="newSearch">
        <input type="text" id="keyword" name="keyword" class="new-srch-input" value="" style="color:#999999;"><a href="javascript:document.getElementById('keyword').value=''" target="_self" class="new-s-close"></a><a href="javascript:search(document.getElementById('keyword').value);" target="_self" class="new-s-srch"><span></span></a>
    </div>
</div>
<div class="new-category">
    <ul class="new-category-lst">
    @foreach (CategoryInfo info in Model.CategoryList)
    {
        if (info.Layer == 1)
        {
            <li class="parentLi">
                <a href="javascript:void(0)" class="new-category-a new-on"><span class="icon"></span>@info.Name</a>
                <ul class="son">
                    @{
                        List<CategoryInfo> itemList = Categories.GetChildCategoryList(info.CateId, 1, Model.CategoryList);
                        for (int i = 0; i < itemList.Count; i = i + 3)
                        {
                            <li class="sonLi">
                                @if (itemList[i].HasChild == 0)
                                {
                                    <a href="@Url.Action("category", "catalog", new RouteValueDictionary { { "cateId" , itemList[i].CateId } })" class="new-category2-a"><span class="new-bar"></span>@itemList[i].Name</a>
                                }
                                else
                                {
                                    <a href="@Url.Action("list", "category", new RouteValueDictionary { { "cateId", itemList[i].CateId } })" class="new-category2-a"><span class="new-bar"></span>@itemList[i].Name</a>
                                }

                            @if((i+1) < itemList.Count)
                            {
                                if (itemList[i + 1].HasChild == 0)
                                {
                                    <a href="@Url.Action("category", "catalog" , new RouteValueDictionary { { "cateId" , itemList[i+1].CateId } })" class="new-category2-a"><span class="new-bar"></span>@itemList[i+1].Name</a>
                                }
                                else
                                {
                                    <a href="@Url.Action("list", "category", new RouteValueDictionary { { "cateId", itemList[i+1].CateId } })" class="new-category2-a"><span class="new-bar"></span>@itemList[i+1].Name</a>
                                }
                            }
                            else
                            {
                                <a href="javascript:void(0)" class="new-category2-a"><span class="new-bar"></span></a>
                            }
                            @if((i+2) < itemList.Count)
                            {
                                if (itemList[i + 2].HasChild == 0)
                                {
                                    <a href="@Url.Action("category", "catalog" , new RouteValueDictionary { { "cateId" , itemList[i+2].CateId } })" class="new-category2-a"><span class="new-bar"></span>@itemList[i + 2].Name</a>
                                }
                                else
                                {
                                    <a href="@Url.Action("list", "category", new RouteValueDictionary { { "cateId", itemList[i+2].CateId } })" class="new-category2-a"><span class="new-bar"></span>@itemList[i+2].Name</a>
                                }
                            }
                            else
                            {
                                <a href="javascript:void(0)" class="new-category2-a"><span class="new-bar"></span></a>
                            }
                             </li>
                        }
                    }
                </ul>
            </li>
        }
    }
    </ul>
</div>
}
else
{
<div class="list p-sort radius">
  <ul>
    @foreach (CategoryInfo info in Model.CategoryList)
    {
    <a href="@Url.Action("category", "catalog", new RouteValueDictionary { { "cateId", info.CateId } })"><li><strong class="name1">@info.Name</strong><span class="menu-botton-arrow"></span></li></a>
    }
  </ul>
</div>
}

@Html.Partial("_footer")
</body>
</html>
